var a = getApp();

Page({
    data: {
        listDatas: [],
        pageNo: 1,
        total: -1,
        city: "",
        province: "",
        role: 0
    },
    clickTeam: function(t) {
        var o = t.currentTarget.dataset.teamid;
        a.util.navToTeamHome(o);
    },
    loadData: function(t) {
        var o = this, e = o.data.pageNo;
        if (t) e = 1; else if (o.data.total == o.data.listDatas.length) return;
        a.network.post({
            url: a.url.searchScheduleHotMoreTeam,
            params: {
                pageNo: e,
                pageSize: 20,
                province: o.data.province,
                city: o.data.city,
                role: o.data.role
            },
            before: function() {
                wx.showNavigationBarLoading();
            },
            success: function(n) {
                if (1 == n.data.result) {
                    var i = [];
                    t || (i = o.data.listDatas), i = i.concat(n.data.data.teams), e += 1, o.setData({
                        total: n.data.data.total,
                        listDatas: i,
                        pageNo: e
                    });
                } else a.util.showToast(n.data.message);
            },
            fail: function() {
                a.util.showToast("获取数据失败");
            },
            complete: function() {
                wx.hideNavigationBarLoading(), wx.stopPullDownRefresh();
            }
        });
    },
    bindClickMember: function(a) {
        var t = a.currentTarget.dataset.token;
        wx.navigateTo({
            url: "/pages/userHome/userHome?userAccessToken=" + t
        });
    },
    onLoad: function(a) {
        console.log(a);
        var t = a.role, o = a.province, e = a.city;
        "市区" != e && "县" != e || (e = ""), this.setData({
            role: t,
            city: e,
            province: o
        }), this.loadData(!0);
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {
        this.loadData(!0);
    },
    onReachBottom: function() {
        this.loadData(!1);
    }
});